home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / basic / vol_inf.exe / VOL-INF.BAS < prev   
BASIC Source File  |  1993-05-03  |  2KB  |  94 lines

  1. 'created 12/22/92
  2. 'updated 04/29/93
  3.  
  4. DEFINT A-Z
  5. 'control over volume labels
  6. DECLARE FUNCTION GETVOL$ (Drive$, ErrCode%)
  7. DECLARE FUNCTION SETVOL% (Drive$, NewName$)
  8.  
  9. Chr34$ = CHR$(34)
  10.  
  11. COLOR 7, 1
  12. CLS
  13. LOCATE 1, 22
  14. PRINT "__ Change Volume Label __"
  15. LOCATE 4, 1
  16.  
  17. LINE INPUT "Enter logical Drive to change: "; Drive$
  18. IF LEN(Drive$) = 0 THEN
  19.     Drive$ = "A:"
  20. ELSE
  21.     Drive$ = UCASE$(Drive$)
  22. END IF
  23. GOSUB ShowLabel
  24.  
  25. PRINT
  26.  
  27. PRINT "A volume label may be upper or lower case or include spaces."
  28. PRINT
  29. LINE INPUT "Please, enter volume label now: "; NewName$
  30. NewName$ = LEFT$(NewName$, 11)    'strip off extra stuff
  31.  
  32. IF LEN(NewName$) > 0 THEN
  33.     T% = SETVOL%(Drive$, NewName$)
  34.     PRINT
  35.     SELECT CASE T%
  36.         CASE 0
  37.             GOSUB ShowLabel
  38.         CASE -2
  39.             PRINT "DOS Version 4 requires SHARE, SHARE not installed."
  40.         CASE -3
  41.             PRINT "DOS Version 3.xx+ required to change label."
  42.         CASE -4
  43.             PRINT "Drive is a NETWORK drive, volume label not possible."
  44.         CASE -5, 8, 3
  45.             PRINT "Invalid character in input string."
  46.             GOSUB ShowLabel
  47.         CASE 82
  48.             PRINT "Error, unable to create that volume label."
  49.             PRINT "Directory is full."
  50.         CASE 21, 83
  51.             PRINT "Error, unable to create that volume label."
  52.             PRINT "Drive not ready."
  53.         CASE ELSE
  54.             PRINT "Error, unable to create that volume label."
  55.             PRINT "DOS error:"; T%
  56.     END SELECT
  57. ELSE
  58.     PRINT "Nothing entered, name unchanged."
  59.     PRINT
  60.     GOSUB ShowLabel
  61. END IF
  62.  
  63. END
  64.  
  65. ShowLabel:
  66. T$ = GETVOL$(Drive$, DosErr%)
  67. IF LEN(T$) > 0 THEN
  68.     PRINT "The current volume label for Drive "; Drive$;
  69.     IF LEN(Drive$) = 1 THEN PRINT ":";
  70.     PRINT " is "; Chr34$; T$; Chr34$
  71. ELSE
  72.     SELECT CASE DosErr%
  73.         CASE 0
  74.             PRINT "No volume label for Drive "; Drive$
  75.         CASE 3
  76.             PRINT "Drive "; Drive$;
  77.             IF LEN(Drive$) = 1 THEN PRINT ":";
  78.             PRINT " not found, nothing to do."
  79.             END
  80.         CASE -1
  81.             PRINT "FCB error."
  82.         CASE 18
  83.             PRINT "No Volume label found."
  84.         CASE 21, 83
  85.             PRINT "Drive "; Drive$;
  86.             IF LEN(Drive$) = 1 THEN PRINT ":";
  87.             PRINT " not ready."
  88.         CASE ELSE
  89.             PRINT "DOS error "; DosErr%
  90.     END SELECT
  91. END IF
  92. RETURN
  93.  
  94.